home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / get_dir < prev    next >
Text File  |  2000-11-27  |  2KB  |  56 lines

  1. SYNOPSIS
  2.         #include <files.h>
  3.  
  4.         string *get_dir(string str, int mask)
  5.  
  6. DESCRIPTION
  7.         This function takes a path as argument and returns an array of
  8.         file names and attributes in that directory.
  9.  
  10.         The filename part of the path may contain '*' or '?' as
  11.         wildcards: every '*' matches an arbitrary amount of characters
  12.         (or just itself). Thus get_dir ("/path/*") would return an
  13.         array of all files in directory "/path/", or just ({ "/path/*"
  14.         }) if this file happens to exist.
  15.  
  16.         The optional second argument mask can be used to get
  17.         information about the specified files.
  18.  
  19.         GETDIR_EMPTY (0x00)  get_dir returns an emtpy array (not very useful)
  20.         GETDIR_NAMES (0x01)  put the file names into the returned array.
  21.         GETDIR_SIZES (0x02)  put the file sizes into the returned array.
  22.                              directories have size FSIZE_DIR (-2)
  23.         GETDIR_DATES (0x04)  put the file modification dates into the returned
  24.                              array.
  25.         GETDIR_UNSORTED (0x20)  if this mask bit is set, the result of will
  26.                              _not_ be sorted.
  27.  
  28.         The values of mask can be added together.
  29.  
  30. EXAMPLES
  31.         get_dir("/w") returns ({ "w" }) (if /w exists)
  32.         get_dir("/w/") and get_dir("/w/.") also both return ({ "w" })
  33.         get_dir("/") and get_dir("/.") return contents of directory "/".
  34.         get_dir(".") returns the base name of the current directory.
  35.  
  36.         get_dir("/path/*") would return an array of all files in
  37.         directory "/path/", or just ({ "/path/*" }) if this file
  38.         happens to exist.
  39.  
  40.         get_dir("/", GETDIR_NAMES) is equivalent to get_dir("/")
  41.         get_dir("/", GETDIR_SIZES) returns an array with the sizes of the
  42.         files in the root directory.
  43.         get_dir("/", GETDIR_NAMES|GETDIR_SIZES|GETDIR_DATES) or shorter
  44.         get_dir("/", GETDIR_ALL)  returns an one-dimensional array that
  45.         contains for each file in the root directory its name, its size and
  46.         its modification date.
  47.  
  48.         transpose_array(({ get_dir(str, GETDIR_NAMES|GETDIR_UNSORTED)
  49.                          , get_dir(str, GETDIR_SIZES)
  50.                          , get_dir(str, GETDIR_DATES) }));
  51.         This returns an array of arrays, with filename, size and
  52.         filetime as elements.
  53.  
  54. SEE ALSO
  55.         cat(E), mkdir(E), rmdir(E), file_size(E)
  56.